package com.ruoyi.system.service.impl;

import com.ruoyi.system.domain.SysListenStudent;
import com.ruoyi.system.mapper.SysListenStudentMapper;
import com.ruoyi.system.service.SysListenStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author: Admin
 * @date: 2021/11/3 14:54
 * @description:
 */
@Service
public class SysListenStudentServiceImpl implements SysListenStudentService {
    @Autowired
    SysListenStudentMapper sysListenStudentMapper;
    @Override
    public List<SysListenStudent> selectStudentAll( SysListenStudent sysListenStudent) {
        return sysListenStudentMapper.selectStudentAll(sysListenStudent);
    }

    /**
     * 删除学生
     *
     * @param ids
     * @return
     */
    @Override
    public int deleteUserByIds(Integer ids) {
        return sysListenStudentMapper.deleteUserByIds(ids);
    }

    /**
     * 修改学生状态
     *
     * @param ids
     * @return
     */
    @Override
    public int updateListenStatusByListenIdAfter(Integer ids) {
        int i = sysListenStudentMapper.searcListenStatusById(ids);
        System.out.println(i);
        if(i==1){
            return sysListenStudentMapper.updateListenStatusByListenIdAfter(ids);
        }
        return 0;

    }

    /**
     * 添加学生
     *
     * @param sysListenStudent
     * @return
     */
    @Override
    public int insertAll(SysListenStudent sysListenStudent) {
        sysListenStudent.setListenCreatTime(new Date());
        return sysListenStudentMapper.insertAll(sysListenStudent);
    }

    @Override
    public SysListenStudent searchAllByListenIdAfter(Integer id) {
        return sysListenStudentMapper.searchAllByListenIdAfter(id);
    }

    /**
     * 根据id修改备注
     *
     * @param id
     * @param text
     */
    @Override
    public int updateListenRemarksByListenId(Integer id, String text) {
        return sysListenStudentMapper.updateListenRemarksByListenId(id,text);
    }

    /**
     * T
     *
     * @param sysListenStudent
     * @return
     */
    @Override
    public int insert(SysListenStudent sysListenStudent) {
        return sysListenStudentMapper.insert(sysListenStudent);
    }
}
